//
//  FloatRecord.m
//  SimulacraDB
//
//  Created by Andre Cohen on 8/30/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "FloatRecord.h"


@implementation FloatRecord

@synthesize value;

- (id)initWithData:(ByteArray *)data {
	[super init];
	[self setValueFromData:data];
	return self;
}

- (id)initWithValue:(NSObject *)data {
	[super init];
	[self setValue:data];
	return self;
}

- (void)setValueFromData:(ByteArray *)data {
	value = [NSNumber numberWithDouble:[data getFloatFromLocation:0]];
}

- (ByteArray *)toByteArray {
	return [ByteArray createFromFloat:[value floatValue]];
}

- (void)setValue:(NSObject *)object {
	value = [NSNumber numberWithDouble:[(NSNumber *)object floatValue]];
}

- (int)size {
	return 8;
}

- (NSString *)description {
	return [value description];
}

- (BOOL)lessThan:(id)anObject {
	return [value compare:[anObject value]]==NSOrderedAscending;
}
- (BOOL)greaterThan:(id)anObject {
	return [value compare:[anObject value]]==NSOrderedDescending;
}
- (BOOL)equalTo:(id)anObject {
	return [value compare:[anObject value]]==NSOrderedSame;
}

@end
